package com.base.action;

import java.util.List;

import com.base.bean.Cardmake;
import com.base.bean.Cardseries;
import com.base.service.CardmakeService;
import com.base.service.CardseriesService;
import com.common.util.PagerModel;
import com.core.ssh2.AbstractActionSupport;
import com.opensymphony.xwork2.Preparable;

public class CardmakeManagerAction extends AbstractActionSupport implements Preparable{
	private static final long serialVersionUID = -7709029092744994742L;

	private CardseriesService cardseriesService;
	
	private CardmakeService cardmakeService;
	
	private Cardmake cardmake;
	
	private long makeno;
	
	private PagerModel pm;
	
	private List<Cardseries> cardserieslist;
	
	public void prepare() throws Exception {
		cardserieslist = cardseriesService.findAllCardseries();
	}
	
	@Override
	public String execute() throws Exception {
		return SUCCESS;
	}
	
	public String goAddCardmake() throws Exception {
		return SUCCESS;
	}
	
	public String addCardmake() throws Exception {
		cardmakeService.addCardmake(cardmake);
		return SUCCESS;
	}
	
	public String findCardmakelist() throws Exception {
		pm = cardmakeService.findCardmakeForPager();
		return SUCCESS;
	}
	
	public String findCardmake() throws Exception {
		cardmake = cardmakeService.findCardmake(makeno);
		return SUCCESS;
	}
	
	public String delCardmake() throws Exception {
		cardmakeService.removeCardmake(makeno);
		return SUCCESS;
	}
	
	public String getCardmakeForUpdate() throws Exception {
		cardmake = cardmakeService.findCardmake(makeno);
		return SUCCESS;
	}
	
	public String updateCardmake() throws Exception {
		cardmakeService.updateCardmake(cardmake);
		return SUCCESS;
	}

	/**
	 * @return the cardmake
	 */
	public Cardmake getCardmake() {
		return cardmake;
	}

	/**
	 * @param cardmake the cardmake to set
	 */
	public void setCardmake(Cardmake cardmake) {
		this.cardmake = cardmake;
	}

	/**
	 * @return the cardmakeService
	 */
	public CardmakeService getCardmakeService() {
		return cardmakeService;
	}

	/**
	 * @param cardmakeService the cardmakeService to set
	 */
	public void setCardmakeService(CardmakeService cardmakeService) {
		this.cardmakeService = cardmakeService;
	}

	/**
	 * @return the cardserieslist
	 */
	public List<Cardseries> getCardserieslist() {
		return cardserieslist;
	}

	/**
	 * @param cardserieslist the cardserieslist to set
	 */
	public void setCardserieslist(List<Cardseries> cardserieslist) {
		this.cardserieslist = cardserieslist;
	}

	/**
	 * @return the cardseriesService
	 */
	public CardseriesService getCardseriesService() {
		return cardseriesService;
	}

	/**
	 * @param cardseriesService the cardseriesService to set
	 */
	public void setCardseriesService(CardseriesService cardseriesService) {
		this.cardseriesService = cardseriesService;
	}

	/**
	 * @return the makeno
	 */
	public long getMakeno() {
		return makeno;
	}

	/**
	 * @param makeno the makeno to set
	 */
	public void setMakeno(long makeno) {
		this.makeno = makeno;
	}

	/**
	 * @return the pm
	 */
	public PagerModel getPm() {
		return pm;
	}

	/**
	 * @param pm the pm to set
	 */
	public void setPm(PagerModel pm) {
		this.pm = pm;
	}

}
